<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>layui</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
		<link rel="stylesheet" href="__CSS__/admin.css" media="all">
		<style type="text/css"> 
			.layui-btn-danger {
				background-color: #2BB6F6;
			}
		</style>
	</head>

	<body style="padding:10px;">
		<div class="tplay-body-div">
			<div class="layui-tab">
				<ul class="layui-tab-title">
					<li><a href="{:url('admin/dinner/desk')}" class="a_menu">餐桌管理</a></li>
					<li class="layui-this">餐桌分类</li>
					<li><a href="{:url('admin/dinner/addarea')}" class="a_menu">新增餐桌分类</a></li>
				</ul>
			</div>
 
			<form class="layui-form serch" action="{:url('admin/dinner/area')}" method="post">
				<div class="layui-form-item" style="float: left;"> 
					<div class="layui-input-inline">
						<div class="layui-inline">
							<select name="store_id" lay-filter="aihao">
								<option value="">请选择所属门店</option>
								{volist name="$list" id="vo"}
								<option value="{$vo.id}" {if condition="$store_id eq $vo.id"}selected{/if}>{$vo.store_name}</option>
								{/volist}
							</select>
						</div>
					</div> 
					<div class="layui-input-inline">
						<input type="text" name="area_name" value="{$area_name}" lay-verify="title" autocomplete="off" placeholder="请输入分类名称" class="layui-input layui-btn-sm">
					</div>
					<button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">查询</button>
				</div>
			</form>
			<table class="layui-table" lay-size="sm">
				<colgroup>
					<col width="100">
					<col width="100">
					<col width="100">
					<col width="100">
					<col width="100"> 
				</colgroup>
				<thead>
					<tr> 
						<th>分类名称</th>
						<th>所属门店</th>
						<th>排序</th>
						<th>餐桌数量</th> 
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					{volist name="area_list" id="vo"}
					<tr> 
						<td>{$vo.area_name}</td>
						<td>{$vo.store_name}</td> 
						<td>{$vo.sort}</td> 
						<td>{$vo.num ? $vo.num : 0}</td> 
						<td>
							<a href="{:url('admin/dinner/editarea',['id'=>$vo.id])}" style="font-size:12px;color: #2BB6F6;">编辑</a> 
							<a href="javascript:;" onclick="dlt('{$vo.id}')" style="font-size:12px;color: #2BB6F6;">删除</a>
						</td>
					</tr>
					{/volist}
				</tbody>
			</table>
			<div style="padding:0 20px;">{$area_list->render()}</div>

			{include file="public/foot"}
            <script> 
            	function dlt(id){ 
					var lay = layer.confirm('确定要删除吗?', {
						icon: 3,
						title: '提示'
					}, function(index) {
						$.ajax({
							type: 'post',
							url: "{:url('dinner/dlt')}",
							dataType: 'json',
							data: {
								id: id 
							},
							success: function(res) { 
								if(res.code == 1) {
			                        layer.msg(res.msg, function(index){
			                            location.href = res.url;
			                        })
			                    } else {
			                        layer.msg(res.msg);
			                    }
							}
						});
					});
				}
            </script>
		</div>
	</body>

</html>